﻿namespace Cos.Module.Blog.Data
{
    using System.Collections.Generic;
    using Cos.Core.Model.Blog;
    using Cos.Core.Model.Common;
    using Cos.Module.Blog.Exceptions;

    /// <summary>
    /// BlogRepository interface
    /// </summary>
    public interface IBlogRepository
    {
        /// <summary>
        /// Gets the list of tags.
        /// </summary>
        IEnumerable<Tag> Tags { get; }

        /// <summary>
        /// Gets the blog by id.
        /// </summary>
        /// <param name="blogId">The blog id.</param>
        /// <param name="culture">The culture.</param>
        /// <returns>The blog found</returns>
        /// <exception cref="BlogNotFoundException">If the blog could not be found or converted</exception>
        Blog GetBlog(int blogId, Culture culture);

        /// <summary>
        /// Used to retrieve the number of articles of a blog.
        /// </summary>
        /// <param name="blogId">The blog id.</param>
        /// <returns>The number of articles</returns>
        int GetNumberOfArticles(int blogId);

        /// <summary>
        /// Gets the article by id.
        /// </summary>
        /// <param name="articleId">The article id.</param>
        /// /// <param name="culture">The culture.</param>
        /// <returns>The article</returns>
        /// <exception cref="ArticleNotFoundException">if the article could not be found or converted</exception>
        Article GetArticle(int articleId, Culture culture);

        /// <summary>
        /// Gets the articles associated to a blog.
        /// </summary>
        /// <param name="blogId">The blog id.</param>
        /// <param name="culture">The culture.</param>
        /// <param name="firstResult">Tell to start at the firstResult id.</param>
        /// <param name="maxResult">The maximum articles to retrieve.</param>
        /// <param name="toDate">The maxResult articles until the toDate is reached.</param>
        /// <returns>articles of the blog</returns>
        /// <exception cref="ArticleNotFoundException">if the article could not be found or converted</exception>
        IEnumerable<Article> GetArticles(int blogId, Culture culture, int firstResult, int maxResult, long toDate);

        /// <summary>
        /// Updates the article.
        /// </summary>
        /// <param name="articleVo">The article.</param>
        void UpdateArticle(Article articleVo);

        /// <summary>
        /// Submits an article.
        /// </summary>
        /// <param name="blogId">The blog id.</param>
        /// <param name="culture">The culture.</param>
        /// <param name="article">The article.</param>
        void SubmitArticle(int blogId, Culture culture, Article article);

        /// <summary>
        /// Deletes an article.
        /// </summary>
        /// <param name="articleId">The article id.</param>
        void DeleteArticle(int articleId);

        /// <summary>
        /// Submit a comment.
        /// </summary>
        /// <param name="culture">The culture.</param>
        /// <param name="comment">The comment.</param>
        void SubmitComment(Culture culture, Comment comment);

        /// <summary>
        /// Deletes the comment.
        /// </summary>
        /// <param name="commentId">The comment id.</param>
        void DeleteComment(int commentId);
    }
}
